package com.syuswe.qimo_02.service.impl;

import com.syuswe.qimo_02.mapper.DeptMapper;
import com.syuswe.qimo_02.pojo.Dept;
import com.syuswe.qimo_02.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author n7c.swe
 * {@code @date} 2024-05
 */
@Service
public class DeptServiceImpl implements DeptService {

    private final DeptMapper deptMapper;
    @Autowired
    public DeptServiceImpl(DeptMapper deptMapper){
        this.deptMapper = deptMapper;
    }
    @Override
    public List<Dept> list() {
        return deptMapper.selectList(null);
    }


    @Override
    public void delete(Integer id) {
        deptMapper.deleteById(id);
    }

    @Override
    public void add(Dept dept) {
        deptMapper.insert(dept);
    }

    @Override
    public void update(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.updateById(dept);
    }


}
